﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unis.Framework.Core.Utility;

using KingRoad.EPM.CompletionMaterialsEntity.Model;
using KingRoad.EPM.CompletionMaterialsDAL.BcdProfiletypeService;


namespace KingRoad.EPM.CompletionMaterialsBLL.UIRules
{
    /// <summary> 
    /// 客户端业务处理类。 
    /// 文件生成时间 2017/8/21 10:02:02
    /// </summary> 
    public class BcdProfiletypeUIRule
    {
        private readonly IBcdProfiletypeService _bcdProfiletypeService;
        
        
        public BcdProfiletypeUIRule(){}
        
        /// <summary> 
        /// construct function... 
        /// </summary> 
        public BcdProfiletypeUIRule(IBcdProfiletypeService  bcdProfiletypeService)
        {
           _bcdProfiletypeService=bcdProfiletypeService;
        }

        /// <summary>
        /// 根据条件获取信息
        /// </summary>
        /// <returns></returns>
        public List<BcdProfiletypeInfo> GetEntityListBySql(string sql)
        {
            var ret = _bcdProfiletypeService.GetEntityList(sql);
            return ret;
        }

        /// <summary>
        /// 查看
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public BcdProfiletypeInfo GetEntityById(Guid id)
        {
            var ret = _bcdProfiletypeService.GetEntityById(id);
            return ret;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool InsertEntity(BcdProfiletypeInfo entity)
        {
            var ret = _bcdProfiletypeService.InsertEntity(entity);
            return ret > 0;
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public bool UpdateEntity(BcdProfiletypeInfo entity)
        {
            var ret = _bcdProfiletypeService.UpdateEntity(entity);
            return ret > 0;
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeleteEntity(string id)
        {
            var ret = _bcdProfiletypeService.DeleteEntityByStringID(id);
            return ret > 0;
        }

        /// <summary>
        /// 根据项目材料类型id  获取该项目下此文档类型的子类型个数
        /// </summary>
        /// <param name="Pft_ID">项目材料类型id</param>
        /// <returns></returns>
        public int GetSonCountByPftID(string Pft_ID)
        {
            return _bcdProfiletypeService.GetSonCountByPftID(Pft_ID);
        }
    }
}

